package com.wyyc.common.carillegalrecord.controller;

import com.alibaba.fastjson.JSON;
import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
import com.wyyc.common.carillegalrecord.service.CarIllegalRecordService;
import com.wyyc.entity.ResJson;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by Hwei~ on 2017/6/7.
 */
@Controller
@RequestMapping("request/carillegal/")
public class CarIllegalRecordController {

    @Resource
    private CarIllegalRecordService carIllegalRecordService;

    //获取本地违章记录
    @RequestMapping(value = "getIllegal",method = RequestMethod.POST,produces = "text/html;charset=UTF-8")
    @ResponseBody
    public String getIllegal(Integer carId){
        if (carId!=null){
            ResJson resJson = carIllegalRecordService.getIllegal(carId);
            return JSON.toJSONString(resJson);
        }
        return "";
    }

    //更新查询违章记录
    @RequestMapping(value = "getNewIllegal",method = RequestMethod.POST,produces = "text/html;charset=UTF-8")
    @ResponseBody
    public String getNewIllegal(Integer carId){
        if (carId!=null){
            ResJson resJson = carIllegalRecordService.getNewIllegal(carId);
            return JSON.toJSONString(resJson);
        }
        return "";
    }
}
